package cn.enjoyedu.fksum.service;

import org.springframework.stereotype.Service;

import java.util.Random;

@Service
public class MakeArray {
    //数组长度
    public static final int ARRAY_LENGTH  = 4000;

    public int[] makeArray(int arrayLength) {

        //new一个随机数发生器
        Random r = new Random();
        if(arrayLength==0) arrayLength = ARRAY_LENGTH;
        int[] result = new int[arrayLength];
        for(int i=0;i<arrayLength;i++){
            //用随机数填充数组
            result[i] =  r.nextInt(arrayLength*3);
        }
        return result;

    }
}
